package cn.wolfcode.luowowo.website.controller;

import cn.wolfcode.luowowo.article.service.IStrategyCommendService;
import cn.wolfcode.luowowo.article.service.ITravelCommendService;
import cn.wolfcode.luowowo.article.service.ITravelService;
import cn.wolfcode.luowowo.common.query.TravelQueryObject;
import cn.wolfcode.luowowo.member.domain.UserInfo;
import cn.wolfcode.luowowo.website.annotation.LoginUser;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class indexController {

    @Reference
    private ITravelCommendService travelCommendService;
    @Reference
    private ITravelService travelService;

    @Reference
    private IStrategyCommendService strategyCommendService;

    @RequestMapping("")
    public String index(Model model) {
        //tcs  推薦游记5篇
        model.addAttribute("tcs", travelCommendService.listTop5());
        //scs    //推荐攻略5片
        model.addAttribute("scs", strategyCommendService.listTop5());
        return "/index/index";
    }

    @RequestMapping("index/travelPage")
    public String travelPage(TravelQueryObject qo, Model model) {
        //pageInfo
        model.addAttribute("pageInfo", travelService.query(qo));

        return "/index/travelPageTpl";
    }





    @RequestMapping("/xxx")
    @ResponseBody
    public UserInfo xxx(@LoginUser UserInfo userInfo) {

        return userInfo;
    }
}
